package org.apache.jsp.view.marca;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import br.com.skpharma.vo.*;
import br.com.skpharma.dao.*;
import java.util.*;

public final class alterar_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final JspFactory _jspxFactory = JspFactory.getDefaultFactory();

  private static java.util.List _jspx_dependants;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.AnnotationProcessor _jsp_annotationprocessor;

  public Object getDependants() {
    return _jspx_dependants;
  }

  public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
  }

  public void _jspDestroy() {
  }

  public void _jspService(HttpServletRequest request, HttpServletResponse response)
        throws java.io.IOException, ServletException {

    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;


    try {
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write('\r');
      out.write('\n');

DAOMarca daoMarca = new DAOMarca();
int codigo = Integer.parseInt(request.getParameter("cod_mar"));
daoMarca.obter(codigo);

if(request.getParameter("Salvar") != null){
	daoMarca.getMarcaVO().setDs(request.getParameter("descricao"));	
	daoMarca.editar();

      out.write('\r');
      out.write('\n');
      out.write('	');
      if (true) {
        _jspx_page_context.forward("index.jsp");
        return;
      }
      out.write('\r');
      out.write('\n');

}

if(request.getParameter("Excluir") != null){
	daoMarca.excluir();

      out.write('\r');
      out.write('\n');
      out.write('	');
      if (true) {
        _jspx_page_context.forward("index.jsp");
        return;
      }
      out.write('\r');
      out.write('\n');

}

      out.write("\r\n");
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<head>\r\n");
      out.write("<title></title>\r\n");
      out.write("<link href=\"../css/css.css\" rel=\"stylesheet\" type=\"text/css\">\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("\r\n");
      out.write("<p align=\"center\">Alterar Cadastro de Marcas</p>\r\n");
      out.write("\r\n");
      out.write("<form method=\"POST\" action=\"alterar.jsp\">\r\n");
      out.write("  <input type=\"hidden\" name=\"cod_mar\" value=\"");
      out.print(daoMarca.getMarcaVO().getCod());
      out.write("\">\r\n");
      out.write("  <div align=\"center\"><center>\r\n");
      out.write("  <table border=\"1\" height=\"103\" style=\"font-size:9px\">\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td width=\"50%\" height=\"23\">Descricao:</td>\r\n");
      out.write("      <td width=\"50%\" height=\"23\"><input style=\"font-size:9px\" type=\"text\" name=\"descricao\" size=\"20\" value=\"");
      out.print(daoMarca.getMarcaVO().getDs());
      out.write("\"></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("    <tr>\r\n");
      out.write("      <td width=\"100%\" height=\"19\" colspan=\"2\"><div align=\"center\"><center><p>\r\n");
      out.write("\t<input type=\"submit\" style=\"font-size:9px\" value=\"Salvar\" name=\"Salvar\">\r\n");
      out.write("\t<input type=\"submit\" style=\"font-size:9px\" value=\"Excluir\" name=\"Excluir\"></td>\r\n");
      out.write("    </tr>\r\n");
      out.write("  </table>\r\n");
      out.write("  </center></div>\r\n");
      out.write("</form>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try { out.clearBuffer(); } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
}
